﻿using System.Collections.Generic;
using System.Linq;

namespace Z.IconLibraryGenerator.WinForm
{
    public partial class ApplicationConfiguration
    {
        /// <summary>Gets the last access projects.</summary>
        /// <param name="top">The top.</param>
        /// <returns>The last access projects.</returns>
        public List<ApplicationProject> GetLastAccessProjects(int top)
        {
            List<ApplicationProject> projects = Projects.Where(x => x.ProjectPath.ToFileInfo().Exists)
                .OrderByDescending(x => x.LastAccessTime)
                .Take(top)
                .ToList();

            return projects;
        }
    }
}